home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / gnome-1.0 / gtk-xmhtml / XmHTML.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-20  |  13.3 KB  |  422 lines

  1. /*****
  2. * XmHTML.h : XmHTML TWidget public header file
  3. *
  4. * This file Version    $Revision: 1.5 $
  5. *
  6. * Creation date:        Tue Nov 19 23:18:37 GMT+0100 1996
  7. * Last modification:     $Date: 1998/02/12 03:08:19 $
  8. * By:                    $Author: unammx $
  9. * Current State:        $State: Exp $
  10. *
  11. * Author:                newt
  12. * (C)Copyright 1995-1996 Ripley Software Development
  13. * All Rights Reserved
  14. *
  15. * This file is part of the XmHTML TWidget Library.
  16. *
  17. * This library is free software; you can redistribute it and/or
  18. * modify it under the terms of the GNU Library General Public
  19. * License as published by the Free Software Foundation; either
  20. * version 2 of the License, or (at your option) any later version.
  21. *
  22. * This library is distributed in the hope that it will be useful,
  23. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  25. * Library General Public License for more details.
  26. *
  27. * You should have received a copy of the GNU Library General Public
  28. * License along with this library; if not, write to the Free
  29. * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  30. *
  31. *****/
  32. /*****
  33. * $Source: /cvs/gnome/gnome-libs/gtk-xmhtml/Attic/XmHTML.h,v $
  34. *****/
  35. /*****
  36. * ChangeLog 
  37. * $Log: XmHTML.h,v $
  38. * Revision 1.5  1998/02/12 03:08:19  unammx
  39. * Merge to Koen's XmHTML 1.1.2 + following fixes:
  40. *
  41. * Wed Feb 11 20:27:19 1998  Miguel de Icaza  <miguel@nuclecu.unam.mx>
  42. *
  43. *     * gtk-forms.c (freeForm): gtk_destroy_widget is no longer needed
  44. *     with the refcounting changes.
  45. *
  46. *     * gtk-xmhtml.c (gtk_xmhtml_remove): Only god knows why I was
  47. *     adding the just removed widget.
  48. *
  49. * Revision 1.4  1998/01/07 01:45:35  unammx
  50. * Gtk/XmHTML is ready to be used by the Gnome hackers now!
  51. * Weeeeeee!
  52. *
  53. * This afternoon:
  54. *
  55. *     - Changes to integrate gtk-xmhtml into an autoconf setup.
  56. *
  57. *     - Changes to make gtk-xmhtml a library to be used by Gnome
  58. *       (simply include <gtk-xmhtml/gtk-xmhtml.h and link
  59. *        with -lgtkxmhtml and you are set).
  60. *
  61. * Revision 1.3  1997/12/29 22:16:21  unammx
  62. * This version does:
  63. *
  64. *    - Sync with Koen to version Beta 1.1.2c of the XmHTML widget.
  65. *      Includes various table fixes.
  66. *
  67. *    - Callbacks are now properly checked for the Gtk edition (ie,
  68. *      signals).
  69. *
  70. * Revision 1.2  1997/12/25 01:34:09  unammx
  71. * Good news for the day:
  72. *
  73. *    I have upgraded our XmHTML sources to XmHTML 1.1.1.
  74. *
  75. *    This basically means that we got table support :-)
  76. *
  77. * Still left to do:
  78. *
  79. *    - Set/Get gtk interface for all of the toys in the widget.
  80. *    - Frame support is broken, dunno why.
  81. *    - Form support (ie adding widgets to it)
  82. *
  83. * Miguel.
  84. *
  85. * Revision 1.1  1997/11/28 03:38:55  gnomecvs
  86. * Work in progress port of XmHTML;  No, it does not compile, don't even try -mig
  87. *
  88. * Revision 1.19  1997/10/26 23:49:52  newt
  89. * Moved internal symbol defines to XmHTMLP.h
  90. *
  91. * Revision 1.18  1997/10/23 00:24:44  newt
  92. * XmHTML Beta 1.1.0 release
  93. *
  94. * Revision 1.17  1997/08/31 17:32:43  newt
  95. * log edit
  96. *
  97. * Revision 1.16  1997/08/30 00:40:16  newt
  98. * Changed proto's for XmHTMLImageReplace and XmHTMLImageUpdate. They now
  99. * return an XmImageStatus instead of void.
  100. *
  101. * Revision 1.15  1997/08/01 12:54:55  newt
  102. * Progressive image loading changes.
  103. *
  104. * Revision 1.14  1997/05/28 01:41:04  newt
  105. * Added the XmHTMLImageGZFSupported, XmHTMLGIFtoGZF, XmHTMLGifReadOK and
  106. * XmHTMLGifGetDataBlock convienience routines to convert GIF images to an
  107. * alternate format. Added the XmHTMLAllocColor and XmHTMLFreeColor protos for
  108. * easy color allocation. Modified the XmImageCreate routines to use a
  109. * XmImageConfig structure.
  110. *
  111. * Revision 1.13  1997/04/29 14:22:35  newt
  112. * Completely revised due to XmHTMLParserObject integration
  113. *
  114. * Revision 1.12  1997/04/03 05:31:30  newt
  115. * XmHTMLFrameGetChild proto. XmIMAGE_SHARED_DATA option bit added.
  116. *
  117. * Revision 1.11  1997/03/28 07:06:14  newt
  118. * XmNframeCallback, XmHTMLFrameCallbackStruct. XmHTMLParserCallback changes.
  119. *
  120. * Revision 1.10  1997/03/20 08:05:02  newt
  121. * XmHTMLImageFreeImageInfo, XmNrepeatDelay
  122. *
  123. * Revision 1.9  1997/03/11 19:50:27  newt
  124. * Changes in XmImageInfo; grouped and renamed convenience functions
  125. *
  126. * Revision 1.8  1997/03/04 18:45:55  newt
  127. * XmNimagemapBoundingBoxForeground and XmCImagemapDrawBoundingBoxes 
  128. * resources added
  129. *
  130. * Revision 1.7  1997/03/04 00:56:30  newt
  131. * Delayed Image Loading: added the delayed field to the XmImageInfo structure. 
  132. * Removed a number of obsolete defines
  133. *
  134. * Revision 1.6  1997/03/02 23:07:10  newt
  135. * Image/Imagemap related changes. XmHTMLAnchorCallbackStruct changed
  136. *
  137. * Revision 1.5  1997/02/11 02:01:26  newt
  138. * Added the XmNhandleShortTags resource
  139. *
  140. * Revision 1.4  1997/02/04 02:55:57  newt
  141. * added the basefont element
  142. *
  143. * Revision 1.3  1997/01/09 06:55:53  newt
  144. * expanded copyright marker
  145. *
  146. * Revision 1.2  1997/01/09 06:47:58  newt
  147. * New resource: XmNparserCallback and corresponding error structure/defines
  148. *
  149. * Revision 1.1  1996/12/19 02:17:14  newt
  150. * Initial Revision
  151. *
  152. *****/ 
  153. /*****
  154. * Public interfaces are listed at the end of this file
  155. *****/
  156.  
  157. #ifndef _XmHTML_h_
  158. #define _XmHTML_h_
  159.  
  160. #define XmHTMLVERSION    1
  161. #define XmHTMLREVISION    1
  162. #define XmHTMLUPDATE_LEVEL 2
  163. #define XmHTMLVersion \
  164.     (XmHTMLVERSION * 1000 + XmHTMLREVISION * 100 + XmHTMLUPDATE_LEVEL)
  165.  
  166. /* used by Imake to get Shared library version numbering */
  167. #ifndef _LIBRARY
  168.  
  169. #define XmHTMLVERSION_STRING \
  170.     "XmHTML Beta Version 1.1.2 (C)Ripley Software Development"
  171.  
  172. /* Required includes */
  173. #ifdef WITH_MOTIF
  174. #    include <X11/Intrinsic.h>
  175. #    include <Xm/Xm.h>
  176. #else
  177. #    include <gtk/gtk.h>
  178. #endif
  179.  
  180. #ifdef WITH_MOTIF
  181. #    include <XmHTML/HTML.h>
  182. #else
  183. #    include <gtk-xmhtml/HTML.h>
  184. #endif
  185.     
  186. _XFUNCPROTOBEGIN
  187.  
  188. #ifdef WITH_MOTIF
  189. #    include "XmHTML-motif.h"
  190. #else
  191. typedef struct _GtkXmHTML *XmHTMLWidget;
  192. #endif
  193.     
  194. /********    Public Function Declarations    ********/
  195.  
  196. /*****
  197. * Convenience/public functions
  198. * There are four categories of them:
  199. * - image related
  200. * - anchor related
  201. * - text related
  202. * - functions that don't fit in any of the above three
  203. *****/
  204.  
  205. /*****
  206. * Image related convenience functions
  207. *****/
  208. extern XmImageInfo *XmHTMLImageDefaultProc(TWidget w, String file,
  209.     unsigned char *buf, int size);
  210.  
  211. /* Return image type */
  212. extern unsigned char XmHTMLImageGetType(String file, unsigned char *buf,
  213.     int size);
  214.  
  215. /* returns True if XmHTMLImageDefaultProc supports JPEG images */
  216. extern Boolean XmHTMLImageJPEGSupported(void);
  217.  
  218. /* returns True if XmHTMLImageDefaultProc supports PNG images */
  219. extern Boolean XmHTMLImagePNGSupported(void);
  220.  
  221. /* returns True if XmHTMLImageDefaultProc supports GZF images */
  222. extern Boolean XmHTMLImageGZFSupported(void);
  223.  
  224. /* Replace image with new_image */
  225. extern XmImageStatus XmHTMLImageReplace(TWidget w, XmImageInfo *image, 
  226.         XmImageInfo *new_image);
  227.  
  228. /* update image */
  229. extern XmImageStatus XmHTMLImageUpdate(TWidget w, XmImageInfo *image);
  230.  
  231. /* release all memory occupied by the images */
  232. extern void XmHTMLImageFreeAllImages(TWidget w);
  233.  
  234. /* add an imagemap to a HTML TWidget. */
  235. extern void XmHTMLImageAddImageMap(TWidget w, String image_map);
  236.  
  237. /* free an XmImageInfo structure */
  238. extern void    XmHTMLImageFreeImageInfo(TWidget w, XmImageInfo *info);
  239.  
  240. /* return the total size of a given XmImageInfo structure */
  241. extern int XmHTMLImageGetImageInfoSize(XmImageInfo *info);
  242.  
  243. /* suspend progressive image loading */
  244. extern void XmHTMLImageProgressiveSuspend(TWidget w);
  245.  
  246. /* reactivate progressive image loading */
  247. extern void XmHTMLImageProgressiveContinue(TWidget w);
  248.  
  249. /* terminate progressive image loading */
  250. extern void XmHTMLImageProgressiveKill(TWidget w);
  251.  
  252. /*****
  253. * Special image functions
  254. *****/
  255. /*****
  256. * Create and return a XmImage for use other than with XmHTML.
  257. * When width and height are non-zero, the image read is scaled to the specified
  258. * dimensions. 
  259. *****/
  260. extern XmImage *XmImageCreate(TWidget w, String file,
  261.     Dimension width, Dimension height, XmImageConfig *config);
  262.  
  263. /*****
  264. * Create an XmImage from the given XmImageInfo. When the image type is
  265. * IMAGE_UNKNOWN, but the url field represents a local file, this routine
  266. * calls XmImageCreate with the url field as the file argument.
  267. * Only honors the ImageFrameSelect, ImageCreateGC and ImageBackground
  268. * XmImageConfig flag and appropriate fields of that structure.
  269. *****/
  270. extern XmImage *XmImageCreateFromInfo(TWidget w, XmImageInfo *info,
  271.     Dimension width, Dimension height, XmImageConfig *config);
  272.  
  273. /* destroy a XmImage */
  274. extern void XmImageDestroy(XmImage *image);
  275.  
  276. /*****
  277. * Tiles "dest" with the given XmImage. Please note that "src" *must* have been
  278. * created with the ImageCreateGC flag, otherwise this function does nothing and
  279. * returns -1. Returns 0 upon success.
  280. * Internally, this routine is more or less a combination of XSetTile,
  281. * XSetTSOrigin and XFillRectangle in one.
  282. *
  283. * (UNTESTED)
  284. *****/
  285. extern int XmImageSetBackgroundImage(XmImage *src, TDrawable dest, int src_x,
  286.     int src_y, int width, int height, int dest_x, int dest_y);
  287.  
  288. /*****
  289. * XCopyArea for an XmImage which also takes a possible clipmask into account.
  290. * Please note that "image" *must* have been created with the ImageCreateGC
  291. * flag, otherwise this function does nothing and returns -1.
  292. * Returns 0 upon success.
  293. *
  294. * (UNTESTED)
  295. *****/
  296. extern int XmImageDrawImage(XmImage *image, TDrawable dest, int src_x,
  297.     int src_y, int dest_x, int dest_y);
  298.  
  299. /*****
  300. * Write an image to file. Returns False upon failure.
  301. * Saving an image in the GIF format is *not* possible due to Unisys's
  302. * stupid LZW licensing policy. Exporting an image as PNG, JPEG or GZF is only
  303. * possible if support for the required libraries has been compiled in.
  304. *
  305. * (UNIMPLEMENTED, always returns False)
  306. *****/
  307. extern Boolean XmImageExport(XmImageInfo *info, String file, Dimension width,
  308.     Dimension height, unsigned char type);
  309.  
  310. /* convert a GIF image to a GZF image */
  311. extern Boolean XmHTMLGIFtoGZF(String infile, unsigned char *buf, int size,
  312.     String outfile);
  313.  
  314. /*****
  315. * Anchor related convenience functions
  316. * These routines can be used to jump to named anchors.
  317. *****/
  318. /* return the internal id of a named anchor given it's name or -1. */
  319. extern int XmHTMLAnchorGetId(TWidget w, String anchor);
  320.  
  321. /* scroll to a named anchor, given it's id */
  322. extern void XmHTMLAnchorScrollToId(TWidget w, int anchor_id);
  323.  
  324. /* scroll to a named anchor, given it's name */
  325. extern void XmHTMLAnchorScrollToName(TWidget w, String anchor);
  326.  
  327. /*****
  328. * Text related convenience functions
  329. *****/
  330. /* This macro sets the given text into a HTML TWidget */
  331. #define XmHTMLTextSet(TWidget,TEXT) XtVaSetValues((TWidget), \
  332.         XmNvalue, (TEXT), NULL)
  333.  
  334. /* scroll to the requested line number */
  335. extern void XmHTMLTextScrollToLine(TWidget w, int line);
  336.  
  337. /* set text into a html TWidget */
  338. extern void XmHTMLTextSetString(TWidget w, String text);
  339.  
  340. /*****
  341. * same as XmHTMLTextSetString with one fundamental difference: text doesn't
  342. * have to be NULL terminated. The size of the input string is instead
  343. * given by len. If text is NULL or len is 0, the current contents are
  344. * cleared.
  345. *****/
  346. extern void XmHTMLTextSetStringWithLength(TWidget w, String text, size_t len);
  347.  
  348. /* return a *pointer* to the original text */
  349. extern String XmHTMLTextGetSource(TWidget w);
  350.  
  351. /* return a copy of the current parser output */
  352. extern String XmHTMLTextGetString(TWidget w);
  353.  
  354.  
  355. /* text search functions */
  356.  
  357. /* search for the string to_find, possibly starting from curr_pos */
  358. extern XmHTMLPosition XmHTMLTextFindString(TWidget w, String to_find,
  359.         XmHTMLDirection dir, XmHTMLPosition curr_pos);
  360.  
  361. /*****
  362. * Return a formatted copy of the current TWidget contents
  363. * (UNIMPLEMENTED, always returns NULL)
  364. *****/
  365. extern String XmHTMLTextGetFormatted(TWidget w, unsigned char papertype,
  366.     XmHTMLPaperSize *paperdef, unsigned char type, unsigned char PSoptions);
  367.  
  368. /*****
  369. * Miscelleneous convenience functions
  370. *****/
  371. /* return the library version number */
  372. extern int XmHTMLGetVersion(void);
  373.  
  374. /* return the URL type of the given href */
  375. extern URLType XmHTMLGetURLType(String href);
  376.  
  377. /* return the value of the <TITLE></TITLE> element */
  378. extern String XmHTMLGetTitle(TWidget w);
  379.  
  380. /* return an info structure for the specified location */
  381. extern XmHTMLInfoStructure *XmHTMLXYToInfo(TWidget w, int x, int y);
  382.  
  383. /****
  384. * Return the contents of the document head. Returns True when a <head></head>
  385. * section is present in the current document, False if not. When mask_bits
  386. * only contains HeadClear, the given attribute structure is wiped clean and
  387. * this function will return False immediatly.
  388. * The only exception concerns the <!DOCTYPE> tag and the HeadDocType mask bit:
  389. * if this bit is set, the value of this tag is returned whether or not a
  390. * head is present.
  391. ****/
  392. extern Boolean XmHTMLGetHeadAttributes(TWidget w, XmHTMLHeadAttributes *head,
  393.     unsigned char mask_bits);
  394.  
  395. /* return the TWidget id of a framechild given its name */
  396. extern TWidget XmHTMLFrameGetChild(TWidget w, String name);
  397.  
  398. /* force a recomputation of screen layout and trigger a redisplay */
  399. extern void XmHTMLRedisplay(TWidget w);
  400.  
  401. /* return info about the font cache for display of the given TWidget */
  402. extern XmHTMLFontCacheInfo *XmHTMLGetFontCacheInfo(TWidget w);
  403.  
  404. /* free the given font cache info */
  405. extern void XmHTMLFreeFontCacheInfo(XmHTMLFontCacheInfo *info);
  406.  
  407. /*
  408. * Allocate given color (symbolic name of rgb triplet) using the TWidget's
  409. * colormap. Works with the XmNmaxImageColors resource.
  410. */
  411. extern Pixel XmHTMLAllocColor(TWidget w, String color, Pixel def_pixel);
  412.  
  413. /* free a color allocated with XmHTMLAllocColor */
  414. extern void XmHTMLFreeColor(TWidget w, Pixel pixel);
  415.  
  416. _XFUNCPROTOEND
  417.  
  418. #endif /* _LIBRARY */
  419.  
  420. /* Don't add anything after this endif! */
  421. #endif /* _XmHTML_h_ */
  422.